package org.compiere.process;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;

import javax.swing.JFileChooser;
import javax.swing.JList;

import jxl.Range;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.CellFormat;
import jxl.format.Colour;
import jxl.format.Format;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.NumberFormats;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import org.adempiere.exceptions.AdempiereException;
import org.compiere.apps.ADialog;
import org.compiere.model.MAttachmentEntry;
import org.compiere.model.MBPartner;
import org.compiere.model.MOrg;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.joda.time.DateTime;

import extend.org.compiere.hrm.ExcelCell;
import extend.org.compiere.utils.Util;
import org.utils.*;

public class FI_DeclarationOfCIT100 extends SvrProcess {

	/** Current context */
	private Properties m_ctx;
	/**     */
	private ProcessInfo pi;

	private Timestamp tsStartDate = null;
	private Timestamp tsEndDate = null;

	private static CLogger s_log = CLogger.getCLogger(BalanceSheets.class);
	/** */
	private String path = "";
	
	private int AD_Org_ID = -1;
	private int AD_Client_ID = -1; 

	/**
	 * Prepare - e.g., get Parameters.
	 */
	@Override
	protected void prepare() {
		log.info("");
		m_ctx = Env.getCtx();
		pi = getProcessInfo();
		ProcessInfoParameter[] para = getParameter();
		for (int i = 0; i < para.length; i++) {
			String name = para[i].getParameterName();
			if (para[i].getParameter() == null)
				;
			else if (name.equals("startDate")) {
				tsStartDate = (Timestamp) para[i].getParameter();
				tsEndDate = (Timestamp) para[i].getParameter_To();
			} else
				log.log(Level.SEVERE, "Unknown Parameter: " + name);
		}

		if (tsEndDate == null)
			tsEndDate = tsStartDate;

		AD_Client_ID = getAD_Client_ID();
		AD_Org_ID = getAD_Org_ID();
		
		path = Util.localFilePath;
		// / here another code)
	}

	@Override
	protected String doIt() throws Exception {
		return uploadToExcel();
	}

	private List<line> getInvoices() {

		List<line> list = new ArrayList<line>();
		//
		PreparedStatement pstmt = null;
		ResultSet rs = null;

		String sql = "select id, to_char(dateacct,'dd.mm.yyyy') as dateacct, documentno, bname, rnn, ch_name, amt\n"
				+ "from (\n"
				+ "	SELECT  head.c_invoice_id as id, head.dateacct as dateacct, head.documentno as documentno,  \n"
				+ "		head.c_bpartner_id as bp_id, bp.name as bname, bp.fi_tin as rnn,\n"
				+ "		ch.name  as ch_name, \n"
				+ "		line.LineNetAmt as amt\n"
				+ "		FROM adempiere.c_invoice head\n"
				+ "		inner join adempiere.c_invoiceline line on line.c_invoice_id = head.c_invoice_id	\n"
				+ "		left join adempiere.c_bpartner bp on bp.c_bpartner_id = head.c_bpartner_id\n"
				+ "		inner join adempiere.c_charge ch on ch.c_charge_id = line.c_charge_id	\n"
				+ "		where head.dateacct between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "		and line.c_charge_id is not null\n"
				+ "		and head.docstatus = 'CO'\n"
				+ "		and line.LineNetAmt > 0 \n"
				+ "		and ch.fi_code not like '6%'\n"
				+ "		\n"
				+ "	union all\n"
				+ "	SELECT  head.c_payment_id as id, head.dateacct as dateacct, head.documentno as documentno,   \n"
				+ "		head.c_bpartner_id as bp_id, bp.name as bname, bp.fi_tin as rnn,\n"
				+ "		ch.name as ch_name,\n"
				+ "		head.PayAmt as amt\n"
				+ "		FROM adempiere.c_payment head\n"
				+ "		left join adempiere.c_bpartner bp on bp.c_bpartner_id = head.c_bpartner_id\n"
				+ "		inner join adempiere.c_charge ch on ch.c_charge_id = head.c_charge_id	\n"
				+ "		where head.dateacct between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "		and head.c_charge_id is not null\n"
				+ "		and head.docstatus = 'CO'\n"
				+ "		and head.PayAmt > 0 \n"
				+ "		and ch.fi_code not like '6%'\n"
				+ "		\n"
				+ "	union all\n"
				+ "	SELECT  head.gl_journal_id as id, head.dateacct as dateacct, head.documentno as documentno,  \n"
				+ "		null as bp_id, null as name, null as rnn,\n"
				+ "		ch.name as ch_name,\n"
				+ "		line.amtsourcedr as amt\n"
				+ "		from adempiere.gl_journal head	\n"
				+ "		inner join adempiere.gl_journalline line on line.gl_journal_id = head.gl_journal_id	\n"
				+ "		inner join adempiere.c_charge ch on ch.c_charge_id = line.c_charge_id	\n"
				+ "		where head.dateacct between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "		and line.c_charge_id is not null\n"
				+ "		and head.docstatus = 'CO'\n"
				+ "		and line.amtsourcedr > 0 \n"
				+ "		and ch.fi_code not like '6%'\n"
				+ "		\n"
				+ "	union all\n"
				+ "	\n"
				+ "	SELECT  head.c_bankstatement_id as id, head.statementdate as dateacct, head.documentno as documentno,  \n"
				+ "		line.c_bpartner_id as bp_id, bp.name as bname, bp.fi_tin as rnn,\n"
				+ "		ch.name as ch_name,\n"
				+ "		line.stmtAmt as amt\n"
				+ "		FROM adempiere.c_bankstatement head	\n"
				+ "		inner join adempiere.c_bankstatementline line on line.c_bankstatement_id = head.c_bankstatement_id	\n"
				+ "		left join adempiere.c_bpartner bp on bp.c_bpartner_id = line.c_bpartner_id\n"
				+ "		inner join adempiere.c_charge ch on ch.c_charge_id = line.c_charge_id	\n"
				+ "		where head.statementdate between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "		and line.c_charge_id is not null\n"
				+ "		and head.docstatus = 'CO'\n"
				+ "		and line.stmtAmt > 0 \n"
				+ "		and ch.fi_code not like '6%'\n" +

				") as main"

		;
		//
		try {
			pstmt = DB.prepareStatement(sql, null);

			rs = pstmt.executeQuery();
			int row = 1;

			while (rs.next()) {
				line l = new line();
				l.setRow(String.valueOf(row));
				l.setDateacct(rs.getString(2));
				l.setDescription(rs.getString(3));
				l.setBname(rs.getString(4));
				l.setRnn(rs.getString(5));
				l.setCh_name(rs.getString(6));
				l.setAmt(rs.getBigDecimal(7));
				list.add(l);
				row++;
			}
		} catch (SQLException e) {
			s_log.log(Level.SEVERE, "product", e);
		} finally {
			DB.close(rs, pstmt);
			rs = null;
			pstmt = null;
		}
		return list;
	}

	private List<group> getGroups() {

		List<group> list = new ArrayList<group>();
		//
		PreparedStatement pstmt = null;
		ResultSet rs = null;

		String sql = "   select ch_name\n"
				+ "   from (\n"
				+ "   	SELECT  ch.name  as ch_name \n"
				+ "   		FROM adempiere.c_invoice head\n"
				+ "   		inner join adempiere.c_invoiceline line on line.c_invoice_id = head.c_invoice_id	\n"
				+ "   		left join adempiere.c_bpartner bp on bp.c_bpartner_id = head.c_bpartner_id\n"
				+ "   		inner join adempiere.c_charge ch on ch.c_charge_id = line.c_charge_id	\n"
				+ "   		where head.dateacct between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "   		and line.c_charge_id is not null\n"
				+ "   		and head.docstatus = 'CO'\n"
				+ "   		and line.LineNetAmt > 0 \n"
				+ "   		and ch.fi_code not like '6%'\n"
				+ "   		\n"
				+ "   	union all\n"
				+ "   	SELECT  ch.name as ch_name\n"
				+ "   		FROM adempiere.c_payment head\n"
				+ "   		left join adempiere.c_bpartner bp on bp.c_bpartner_id = head.c_bpartner_id\n"
				+ "   		inner join adempiere.c_charge ch on ch.c_charge_id = head.c_charge_id	\n"
				+ "   		where head.dateacct between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "   		and head.c_charge_id is not null\n"
				+ "   		and head.docstatus = 'CO'\n"
				+ "   		and head.PayAmt > 0 \n"
				+ "   		and ch.fi_code not like '6%'\n"
				+ "   		\n"
				+ "   	union all\n"
				+ "   	SELECT  ch.name as ch_name\n"
				+ "   		from adempiere.gl_journal head	\n"
				+ "   		inner join adempiere.gl_journalline line on line.gl_journal_id = head.gl_journal_id	\n"
				+ "   		inner join adempiere.c_charge ch on ch.c_charge_id = line.c_charge_id	\n"
				+ "   		where head.dateacct between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "   		and line.c_charge_id is not null\n"
				+ "   		and head.docstatus = 'CO'\n"
				+ "   		and line.amtsourcedr > 0 \n"
				+ "   		and ch.fi_code not like '6%'\n"
				+ "   		\n"
				+ "   	union all\n"
				+ "   	\n"
				+ "   	SELECT  \n"
				+ "   		ch.name as ch_name\n"
				+ "   		FROM adempiere.c_bankstatement head	\n"
				+ "   		inner join adempiere.c_bankstatementline line on line.c_bankstatement_id = head.c_bankstatement_id	\n"
				+ "   		left join adempiere.c_bpartner bp on bp.c_bpartner_id = line.c_bpartner_id\n"
				+ "   		inner join adempiere.c_charge ch on ch.c_charge_id = line.c_charge_id	\n"
				+ "   		where head.statementdate between '"
				+ tsStartDate
				+ "' and '"
				+ tsEndDate
				+ "' 	\n"
				+ "   		and line.c_charge_id is not null\n"
				+ "   		and head.docstatus = 'CO'\n"
				+ "   		and line.stmtAmt > 0 \n"
				+ "   		and ch.fi_code not like '6%'\n"
				+ "   ) as main\n"
				+ "   group by ch_name\n" + "   order by ch_name";
		//
		try {
			pstmt = DB.prepareStatement(sql, null);

			rs = pstmt.executeQuery();
			while (rs.next()) {
				group l = new group();
				l.setGroupName(rs.getString(1));
				list.add(l);
			}
		} catch (SQLException e) {
			s_log.log(Level.SEVERE, "product", e);
		} finally {
			DB.close(rs, pstmt);
			rs = null;
			pstmt = null;
		}
		return list;
	}

	protected String uploadToExcel() throws Exception {

		// Types of cells for
		Label label;
		Number number;
		// There are checks for a specified pattern
		String templateName = "FI_DeclarationOfCIT100_tmpl.xls";
		//
		MAttachmentEntry entry = Util.getAttachment(pi, m_ctx, templateName);
		if (entry == null)
			throw new AdempiereException(Msg.translate(m_ctx,
					"NotFoundTemplate") + " " + templateName);

		File templateCopy = new File(Util.localFilePath
				+ "FI_DeclarationOfCIT100.xls");
		File temporaryFile = entry.getFile(Util.localFilePath + templateName);
		Workbook tableBook = null;
		WritableWorkbook copy = null;
		WritableSheet sheet = null;
		try {
			tableBook = Workbook.getWorkbook(temporaryFile);
			copy = Workbook.createWorkbook(templateCopy, tableBook);
			sheet = copy.getSheet(0);
		} catch (Exception e) {
			ADialog.error(999, null, "Error tableBook. " + e.getMessage());
			return "Error tableBook.";
		}

		// Style for value column
		WritableCellFormat valuestyle = new WritableCellFormat();
		valuestyle.setBorder(Border.LEFT, BorderLineStyle.MEDIUM, Colour.BLACK);
		valuestyle.setBorder(Border.RIGHT, BorderLineStyle.THIN, Colour.BLACK);
		valuestyle.setBorder(Border.BOTTOM, BorderLineStyle.THIN, Colour.BLACK);
		valuestyle.setBorder(Border.TOP, BorderLineStyle.THIN, Colour.BLACK);
		valuestyle.setAlignment(Alignment.RIGHT);
		valuestyle.setVerticalAlignment(VerticalAlignment.CENTRE);
		valuestyle.setWrap(true);

		WritableFont arial10ptBold = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD);
		WritableCellFormat wcfBold = new WritableCellFormat(arial10ptBold);
		wcfBold.setBorder(Border.LEFT, BorderLineStyle.MEDIUM, Colour.BLACK);
		wcfBold.setBorder(Border.RIGHT, BorderLineStyle.THIN, Colour.BLACK);
		wcfBold.setBorder(Border.BOTTOM, BorderLineStyle.THIN, Colour.BLACK);
		wcfBold.setBorder(Border.TOP, BorderLineStyle.THIN, Colour.BLACK);
		wcfBold.setAlignment(Alignment.RIGHT);
		wcfBold.setVerticalAlignment(VerticalAlignment.CENTRE);
		wcfBold.setWrap(true);		
		
		WritableFont arial10ptNoBold = new WritableFont(WritableFont.ARIAL, 10,	WritableFont.NO_BOLD);
		WritableCellFormat cfNumber = new WritableCellFormat(arial10ptNoBold,NumberFormats.THOUSANDS_FLOAT);
		cfNumber.setBorder(Border.LEFT, BorderLineStyle.MEDIUM, Colour.BLACK);
		cfNumber.setBorder(Border.RIGHT, BorderLineStyle.THIN, Colour.BLACK);
		cfNumber.setBorder(Border.BOTTOM, BorderLineStyle.THIN, Colour.BLACK);
		cfNumber.setBorder(Border.TOP, BorderLineStyle.THIN, Colour.BLACK);
		cfNumber.setAlignment(Alignment.RIGHT);
		cfNumber.setVerticalAlignment(VerticalAlignment.CENTRE);
		cfNumber.setWrap(true);

		WritableCellFormat cfNumberBold = new WritableCellFormat(arial10ptBold,NumberFormats.THOUSANDS_FLOAT);
		cfNumberBold.setBorder(Border.LEFT, BorderLineStyle.MEDIUM, Colour.BLACK);
		cfNumberBold.setBorder(Border.RIGHT, BorderLineStyle.THIN, Colour.BLACK);
		cfNumberBold.setBorder(Border.BOTTOM, BorderLineStyle.THIN, Colour.BLACK);
		cfNumberBold.setBorder(Border.TOP, BorderLineStyle.THIN, Colour.BLACK);
		cfNumberBold.setAlignment(Alignment.RIGHT);
		cfNumberBold.setVerticalAlignment(VerticalAlignment.CENTRE);
		cfNumberBold.setWrap(true);		
		
		List<line> l = getInvoices();
		List<group> gl = getGroups();
		int count = l.size();
		int row = 10;

// РНН
		String sRNN = getRNN(getOrgBPartner_ID(AD_Org_ID));

		WritableFont arial10ptBoldRNN = new WritableFont(WritableFont.ARIAL, 10,	WritableFont.BOLD);
		WritableCellFormat wcfRNN = new WritableCellFormat(arial10ptBoldRNN);
		wcfRNN.setAlignment(Alignment.CENTRE);
		wcfRNN.setVerticalAlignment(VerticalAlignment.CENTRE);

		label = new Label(5, 2, sRNN, wcfRNN);
		sheet.addCell(label);
		
// Имя организации
		String sName = getOrgName(AD_Org_ID);
		WritableCellFormat wcfsName = new WritableCellFormat(arial10ptBoldRNN);
		wcfsName.setAlignment(Alignment.CENTRE);
		wcfsName.setVerticalAlignment(VerticalAlignment.CENTRE);

		label = new Label(23, 4, sName, wcfsName);
		sheet.addCell(label);

// БИК
		String sBIN = getBIN(getOrgBPartner_ID(AD_Org_ID));
		WritableCellFormat wcfBIN = new WritableCellFormat(arial10ptBoldRNN);
		wcfBIN.setAlignment(Alignment.CENTRE);
		wcfBIN.setVerticalAlignment(VerticalAlignment.CENTRE);

		label = new Label(29, 2, sBIN, wcfBIN);
		sheet.addCell(label);

		
		String caption = " c "
				+ new java.text.SimpleDateFormat("dd.MM.yyyy").format(
						tsStartDate).toString()
				+ " по "
				+ new java.text.SimpleDateFormat("dd.MM.yyyy")
						.format(tsEndDate).toString();
		WritableCellFormat captionStyle = new WritableCellFormat();
		captionStyle.setAlignment(Alignment.CENTRE);
		captionStyle.setVerticalAlignment(VerticalAlignment.CENTRE);

		label = new Label(11, 6, caption, captionStyle);
		sheet.addCell(label);

		for (int j = 0; j < (count + gl.size()-1); j++) {
			sheet.insertRow(row);
			sheet.setRowView(row, 700);
			sheet.mergeCells(1, row, 3, row);
			sheet.mergeCells(4, row, 14, row);
			sheet.mergeCells(15, row, 25, row);
			sheet.mergeCells(26, row, 33, row);
			sheet.mergeCells(34, row, 41, row);
			sheet.mergeCells(42, row, 49, row);
			sheet.mergeCells(50, row, 57, row);
			sheet.mergeCells(58, row, 65, row);
			sheet.mergeCells(66, row, 73, row);
			sheet.mergeCells(74, row, 81, row);
			sheet.mergeCells(82, row, 89, row);
		}

		group gr = null;
		BigDecimal SummTotal = new BigDecimal(0);

		for (int i = 0; i < gl.size(); i++) {
			gr = gl.get(i);
			BigDecimal SummGr = new BigDecimal(0);
			int first = 0;
			for (int j = 0; j < count; j++) {
				
				line li = l.get(j);
				if (li.getCh_name().equals(gr.getGroupName())) {
					
					label = new Label(1, row, Integer.toString(row-9), valuestyle);
					sheet.addCell(label);

					label = new Label(4, row, "", valuestyle);
					sheet.addCell(label);
					
//					first++;
//					if (first == 1) {
						label = new Label(15, row, li.ch_name, valuestyle);
						sheet.addCell(label);
//					}else{
//						label = new Label(15, row, "", valuestyle);
//						sheet.addCell(label);
//					}

					label = new Label(26, row, li.bname, valuestyle);
					sheet.addCell(label);

					label = new Label(34, row, li.rnn, valuestyle);
					sheet.addCell(label);

					label = new Label(42, row, li.dateacct, valuestyle);
					sheet.addCell(label);

					label = new Label(50, row, li.description, valuestyle);
					sheet.addCell(label);

					number = new Number(58, row, li.amt.doubleValue(), cfNumber);
					sheet.addCell(number);

					number = new Number(66, row, li.amt.doubleValue(), cfNumber);
					sheet.addCell(number);

					// ------null
					// label = new Label(66, row, "", valuestyle);
					// sheet.addCell(label);
					label = new Label(74, row, "", valuestyle);
					sheet.addCell(label);
					label = new Label(82, row, "", valuestyle);
					sheet.addCell(label);

					SummGr = SummGr.add(li.amt);

					row++;
				}
			}

					label = new Label(1, row, "", wcfBold);
					sheet.addCell(label);
		
					label = new Label(4, row, "", wcfBold);
					sheet.addCell(label);

			
			label = new Label(15, row, "Всего по: " + gr.getGroupName(),cfNumberBold);
			sheet.addCell(label);

					label = new Label(26, row, "", wcfBold);
					sheet.addCell(label);
		
					label = new Label(34, row, "", wcfBold);
					sheet.addCell(label);
		
					label = new Label(42, row, "", wcfBold);
					sheet.addCell(label);
		
					label = new Label(50, row, "", wcfBold);
					sheet.addCell(label);
			
			number = new Number(58, row, SummGr.doubleValue(), cfNumberBold);
			sheet.addCell(number);
			number = new Number(66, row, SummGr.doubleValue(), cfNumberBold);
			sheet.addCell(number);
			SummTotal = SummTotal.add(SummGr);

				label = new Label(74, row, "", wcfBold);
				sheet.addCell(label);
				label = new Label(82, row, "", wcfBold);
				sheet.addCell(label);			
			
			row++;

		}
		
		
		number = new Number(58, row, SummTotal.doubleValue(), cfNumberBold);
		sheet.addCell(number);
		number = new Number(66, row, SummTotal.doubleValue(), cfNumberBold);
		sheet.addCell(number);

		
		copy.write();
		copy.close();
		tableBook.close();
		temporaryFile.delete();
		//
		try {
			String fileName = Util.localFilePath
					+ "FI_DeclarationOfCIT100.xls";// fullPath.toString();
			String command = "excel \"" + fileName + "\"";
			Runtime.getRuntime().exec("cmd /c start " + command);
		} catch (Exception e) {
			e.printStackTrace();
		}

		return Msg.translate(m_ctx, "Success");
	}

	private String getRNN(int C_BPartner_ID) {
		String result = "";
		MBPartner bPartner = new MBPartner(getCtx(), C_BPartner_ID, null);
		result = bPartner.getFI_TIN();
		return result;
	}

	private String getBIN(int C_BPartner_ID) {
		String result = "";
		MBPartner bPartner = new MBPartner(getCtx(), C_BPartner_ID, null);
		result = bPartner.getFI_BIN_IIN();
		return result;
	}

	private String getOrgName(int AD_Org_ID) {
		String result = "";
		MOrg org = new MOrg(getCtx(), AD_Org_ID, null);
		result = org.getName();
		return result;
	}

	protected int getOrgBPartner_ID(int AD_Org_ID) {
		int result = -1;
		MOrg org = new MOrg(getCtx(), AD_Org_ID, null);
		result = org.getLinkedC_BPartner_ID(null);
		return result;
	}
	
	private int getAD_Org_ID() {
		int result = -1;
		String sql = "SELECT AD_Org_ID FROM AD_PInstance WHERE AD_PInstance_ID=?";
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		try
		{
			pstmt = DB.prepareStatement(sql, get_TrxName());
			pstmt.setInt(1, getAD_PInstance_ID());
			rs = pstmt.executeQuery();
			if (rs.next())
			{
				result = rs.getInt(1);
			}
		}
		catch (SQLException e)
		{
			log.log(Level.SEVERE, sql, e);
		}
		finally {
			DB.close(rs, pstmt);
			rs = null; pstmt = null;
		}
		return result;
	}
	
	class line {
		String row;
		String dateacct;
		String description;
		String ch_name;
		String rnn;
		String bname;
		BigDecimal amt;

		public String getRow() {
			return row;
		}

		public void setRow(String row) {
			this.row = row;
		}

		public String getDateacct() {
			return dateacct;
		}

		public void setDateacct(String dateacct) {
			this.dateacct = dateacct;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public String getCh_name() {
			return ch_name;
		}

		public void setCh_name(String ch_name) {
			this.ch_name = ch_name;
		}

		public String getRnn() {
			return rnn;
		}

		public void setRnn(String rnn) {
			this.rnn = rnn;
		}

		public String getBname() {
			return bname;
		}

		public void setBname(String bname) {
			this.bname = bname;
		}

		public BigDecimal getAmt() {
			return amt;
		}

		public void setAmt(BigDecimal amt) {
			this.amt = amt;
		}

	}

	class group {
		String groupName;

		public String getGroupName() {
			return groupName;
		}

		public void setGroupName(String groupName) {
			this.groupName = groupName;
		}

	}

}